package com.qiku.test;

import com.qiku.dao.UserMapper;
import com.qiku.domin.User;
import com.qiku.domin.UserVO;
import com.qiku.service.UserService;
import org.apache.commons.beanutils.BeanUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext-service.xml")
public class TesUserService {
    @Autowired
    private UserService userService;

    @Autowired
    private UserMapper userMapper;



    @Test
    public void  testLogin() throws Exception {
        UserVO userVO = new UserVO();
        userVO.setPhone("110110110");
        userVO.setPassword("123456");
        User login = userService.login(userVO);
        System.out.println(login);
    }

    @Test
    public void  testLogin2() throws Exception {
        UserVO userVO = new UserVO();
        userVO.setPhone("110110110");
        userVO.setPassword("123456");
        User user = new User();
        BeanUtils.copyProperties(user , userVO);
        User login = userMapper.login(user);
        System.out.println(login);
    }
}
